﻿

<div class="col-lg-12">
    <div class="space-20 hidden-md hidden-lg"></div>
    <div class="space-4 hidden-sm hidden-xs"></div>
    <select id="type1" name="">
        <option selected="" value="0">时间降序</option>
        <option value="1">时间升序</option>
    </select>
    <select id="type2" name="">
        <option selected="" value="0">评价降序</option>
        <option value="1">评价升序</option>
    </select>
    <a onclick="Search(1)" href="javascript:void(0)" class="easyui-linkbutton" title="筛选" data-options="iconCls:'icon-search',plain:true,iconAlign:'right'"><input class="input-small" type="text" name="" id="selecttext" value="" placeholder="请输入查询条件" style="vertical-align:middle;line-height:normal;" onclick="searchinput(this)" /></a>
    <div class="space-2"></div>
</div>
<div class="page-content">

    <table id="dg" class="easyui-datagrid" title="评价一览" style="width:100%;height:auto"></table>
    <script type="text/javascript">

        $(function () {
            $(".nav-list li").eq(4).addClass("active");
            $('#dg').datagrid({
                rownumbers: true,
                checkOnSelect: false,
                url: '/Emp/AllAss',
                pagination: true,
                pageSize: 10,
                method: 'get',
                striped: true,
                singleSelect: true,
                selectOnCheck: false,
                fitColumns: true,
                loadMsg: "loading...",
                columns: [[
                    {
                        field: 'Type', title: '商品类型', width: 30,
                        formatter: function (value, row, index) {

                            switch (row.goodsType) {
                                case 0: return "零食";
                                case 1: return "五金";
                                case 2: return "家居";
                                case 3: return "烹饪";
                                default: return "未知";
                            }
                        }
                    },
                    { field: 'goodsName', title: '商品名称', width: 30 },
                    { field: 'amount', title: '消费金额', width: 30 },
                    { field: 'customer', title: '用户名', width: 50 },
                    { field: 'postName', title: '送货员名', width: 50 },
                    { field: 'grade', title: '评价等级', width: 20 },
                    { field: 'assess', title: '评价内容', width: 80 },
                    { field: 'startTime', title: '下单时间', width: 50 },
                    { field: 'endTime', title: '签收时间', width: 50 },

                ]],
                onHeaderContextMenu: function (e, field) {
                    e.preventDefault();

                    if (!cmenu) {
                        createColumnMenu();
                    }
                    cmenu.menu('show', {
                        left: e.pageX,
                        top: e.pageY
                    });
                }
            });
        })


        function searchinput(elem) {

            var e = event || window.event;
            e.stopPropagation();
        }



        function clearForm(obj) {

            $(obj).form("clear");
        }

        function Search(_pageNumber) {
            var val = {};
            val.pageNumber = _pageNumber;
            val.pageSize = $("#dg").datagrid("getPager").pagination("options").pageSize;
            val.type1 = $("#type1").val();
            val.type2 = $("#type2").val();
            val.text = $("#selecttext").val();

            $.ajax({
                type: 'get',
                url: '/Emp/Search',
                async: true,
                dataType: 'json',
                data: val,
                success: function (result) {
                    $('#dg').datagrid('loadData', result);
                    $("#dg").datagrid("getPager").pagination({
                        onSelectPage: function (pageNumber, pageSize) {
                            Search(pageNumber);

                        },
                        onRefresh: function (pageNumber, pageSize) {
                            Search(pageNumber);
                        }
                    });
                }
            });
        }
    </script>

    <div id="win_add" class="easyui-window" title="添加" style="width:350px;height:280px;display:none;" data-options="iconCls:'icon-edit',shadow:false,collapsible:false,minimizable:false,closed:true,modal:true">
        <div class="easyui-layout" data-options="fit:true">
            <div data-options="region:'center'" style="text-align:center;">
                <div class="space-20"></div>
                <form class="window_form" id="form_add" method="post">
                    <div>
                        <label>类型:</label>
                        <select name="Type" required style="width:60%;">
                            <option value="0">零食</option>
                            <option value="1">五金</option>
                            <option value="2">家居</option>
                            <option value="3">烹饪</option>
                            <option value="4" selected="selected">其他</option>
                        </select>
                    </div>
                    <div>
                        <label>名称:</label><input class="easyui-textbox" singleSelect="true" name="Name" data-options="required:true,width:200" />
                    </div>
                    <div>
                        <label>详情:</label><input class="easyui-textbox" name="Detail" data-options="required:true,width:200" />
                    </div>
                    <div>
                        <label>单价:</label><input class="easyui-textbox" singleSelect="true" name="Price" data-options="required:true,width:200" />
                    </div>
                    <div>
                        <label>质量:</label><input class="easyui-textbox" singleSelect="true" name="Weight" data-options="required:true,width:200" />
                    </div>
                    <div>
                        <label>备注:</label><input class="easyui-textbox" singleSelect="true" name="Remark" data-options="required:false,width:200" />
                    </div>
                    <div>
                        <img id="showImg" align="center" src="" style="width:100px;height:100px;display:none;margin:0,auto;" />
                        <input type="text" id="Img" name="Img" style="display:none " value="" />
                    </div>
                    <div>
                        <input type="button" class="btn btn-file" onclick="upload(this)" value="图片上传" />
                    </div>

                    <div class="space-10"></div>
                    <div style="text-align:center;padding:5px 0">
                        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submit('#form_add')" style="width:80px;height:30px">提交</a>
                        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm('#form_add')" style="width:80px;height:30px">清空</a>
                    </div>
                </form>

            </div>
        </div>
    </div>
</div>

